<?php
/**
 * Open Framework
 *
 * LICENSE
 *
 *this file is a template.
 *
 *
 * @category   
 * @package    
 * @subpackage 
 * @copyright  copyright
 * @license    $Id: file.php 5308 2008-12-13 17:18:45Z fy $
 */


/**
 * Db_Update 
 *
 * @category   
 * @package    
 * @subpackage 
 * @copyright  
 * @license    
 */
class FreeY_Db_Table_Delete extends FreeY_Db_Table_Abstract
{
	/**
	 * _method_info
	 *
	 * @param $var
	 * @return viod
	 */
	public function start($input)
	{
		$this->input = $input;
	}
	/**
	 * _method_info
	 *
	 * @param $var
	 * @return viod
	 */
	public function run()
	{
		$tablename = $this->input['tablename'];
		$sql = $this->_getSql($tablename, $this->getWhere());
		return $sql;
	}
	/**
	 * _method_info
	 *
	 * @param $var
	 * @return viod
	 */
	protected function _getSql($tablename, $where)
	{
		$sql='delete from ' . $tablename . $where;
		return $sql;
	}
	/**
	 * getWhere
	 *
	 * @param $var
	 * @return viod
	 */
	protected function getWhere()
	{
		$arr = $this->input['where'];
		if(! is_array ($arr)) return ;
		$ret=' where 1 ';
		foreach ( $arr as $value )
		{
			$ret .= ' and ' . $value . ' ';
		}
		return $ret;
	}
}
//file end--------------------------------------------------------->
?>